package com.hirelinfo.service.faculty;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hirelinfo.dao.faculty.HibernateDao;
import com.hirelinfo.dto.faculty.User;

@Service
public class UserManagerService {
	
	@Autowired
	HibernateDao commonDao;
	
	
	
	public void saveNewUser(User user){

		if(null!=user){
			commonDao.insertNewRow(user);
		}
		
	}
	
	public List<User> getAllCityUswe(){
		
		DetachedCriteria criteria=DetachedCriteria.forClass(User.class);
	      criteria.add(Restrictions.eq("city", "Allahabad"));
	      
	List list=      commonDao.loadAllRowsForCriteria(criteria);
	 if(null!=list && list.size()>0){
		 
		 System.out.println("User List is not found.");
		 
	 }
	
	
	      
		return list;
	}
	
	
	
	
	
	
	

}
